from django.shortcuts import render
from django.views import View

from apps.goods.utils import get_categories


class IndexView(View):
    def get(self,request):
        # 查询商品频道和分类
        categories = get_categories()  # 调用显示分类方法
        # 渲染模板的上下文
        context = {
            'categories': categories,
        }
        return render(request,'index.html',context)